home *** CD-ROM | disk | FTP | other *** search
- defineps wallpaper(float wild, boxsize, brightness)
- brightness boxsize wild wallpaper
- endps
-
- defineps loadwallpaper()
-
- /wallpaper { % brightness boxsize wild
-
- /wild exch def
- /boxsize exch def
- /brightness exch def
-
- % Gradient wrapping paper, symmetry group P4M
- % Elizabeth D. Zwicky
- % zwicky@erg.sri.com
-
- usertime srand
- /seed rand def
-
- % If you are using a wildness of .5 or less, you may find it
- % interesting to specify a hue explicitly instead of letting it pick one
- % for you. (At a wildness of 1, it may still be interesting, but your
- % desired hue may not be dominant in the result.) Hue is a standard
- % PostScript hue, a number between 1 and 0 where 0 is true red,
- % .333333 is true green, .66666 is true blue.
-
- /hue rand 999 mod 1000 div def
-
- % There are 30 hue changes per page, so .033 gives you approximately
- % one rainbow, and .01 gets you approximately the difference from one
- % primary to the next.
- % When wild is 1, how fast should the hue migrate?
-
- /wildmig .033 def
-
- % When wild is less than 1, how fast should the hue migrate?
-
- /mig 0 def
-
- /firsthue hue def
- /ohue rand 2 mod 0 eq
- { hue .5 add dup 1 gt {1 sub} if }
- { hue .2 add dup 1 gt {1 sub} if }
- ifelse
- def
-
- /sat 1 def
- /bright 1 def
- /obright 1 def
-
- wild -1 eq
- {/colorfill { 0 setgray stroke } def
- /ocolorfill { 0 setgray stroke } def}
- {/colorfill {hue sat bright brightness mul sethsbcolor fill } def
- /ocolorfill {ohue sat obright brightness mul sethsbcolor fill } def}
- ifelse
-
- clippath pathbbox /ury exch def /urx exch def /lly exch def /llx exch def
-
- % You might want to replace "1 1" with "rand 99 mod 100 div rand 99
- % mod 100 div" when running at a wildness of negative 1. For that
- % matter, for that pastel, money-like effect, try "rand 50 mod 100
- % div 100 rand 25 mod sub 100 div"
-
- hue 1 1 brightness mul sethsbcolor fill
-
- /limit boxsize 2 div cvi def
- /x {rand limit mod dup /curx exch def } def
- /y {rand limit curx sub mod curx add } def
- /any {rand limit mod} def
-
- llx lly translate
-
- /xtimes urx llx sub boxsize div 1.5 add cvi def
- /ytimes ury lly sub boxsize div 1.5 add cvi def
-
- /anyone any def /anytwo any def
- /xone x def /xtwo x def /xthree x def /xfour x def /xfive x def /xsix
- x def /xseven x def /xeight x def
- /yone y def /ytwo y def /ythree y def /yfour y def
-
- % /xtimes 2 def /ytimes 2 def
-
- xtimes {
- ytimes {
- /scaleby 1 def /bright 1 def /obright 0 def
- /ohue firsthue def
- 10 {
- wild 1 eq {/obright 1 def} if
- limit limit translate
- limit xone sub scaleby mul neg 0 moveto
- limit xtwo sub scaleby mul neg dup lineto
- 0 limit xone sub scaleby mul neg lineto
- limit xtwo sub scaleby mul dup neg lineto
- limit xone sub scaleby mul 0 lineto
- limit xtwo sub scaleby mul dup lineto
- 0 limit xone sub scaleby mul lineto
- limit xtwo sub scaleby mul neg dup neg lineto
- limit xone sub scaleby mul neg 0 lineto
- ocolorfill
-
- limit neg limit neg translate
- /scaleby scaleby .1 sub def
-
- wild 1 eq
- {/ohue ohue wildmig add dup 1 gt {1 sub} if def}
- {/obright obright .1 add def /ohue ohue mig add dup 1 gt {1 sub} if def}
- ifelse
- } repeat
- /scaleby 1 def /obright 0 def
- wild .5 eq {/ohue ohue .15 add dup 1 gt {1 sub} if def} if
- 10 {
- wild 1 eq {/obright 1 def} if
-
- 0 limit translate
- 0 0 moveto
- 0 limit anyone sub scaleby mul neg moveto xone scaleby mul 0 lineto
- 0 limit anyone sub scaleby mul lineto
- xone scaleby mul neg 0 lineto
- 0 limit anyone sub scaleby mul neg lineto
-
- 0 limit scaleby mul neg moveto
- xthree scaleby mul limit yone sub scaleby mul neg
- xfour scaleby mul limit ytwo sub scaleby mul neg
- xfive scaleby mul 0 curveto
- xfour scaleby mul limit ytwo sub scaleby mul
- xthree scaleby mul limit yone sub scaleby mul
- 0 limit scaleby mul curveto
- xthree scaleby mul neg limit yone sub scaleby mul
- xfour scaleby mul neg limit ytwo sub scaleby mul
- xfive scaleby mul neg 0 curveto
- xfour scaleby mul neg limit ytwo sub scaleby mul neg
- xthree scaleby mul neg limit yone sub scaleby mul neg
- 0 limit scaleby mul neg curveto
- ocolorfill
-
- limit limit neg translate
- 0 0 moveto
- limit anyone sub scaleby mul neg 0 moveto
- 0 xone scaleby mul lineto
- limit anyone sub scaleby mul 0 lineto
- 0 xone scaleby mul neg lineto
- limit anyone sub scaleby mul neg 0 lineto
-
- limit scaleby mul neg 0 moveto
- limit yone sub scaleby mul neg xthree scaleby mul
- limit ytwo sub scaleby mul neg xfour scaleby mul
- 0 xfive scaleby mul curveto
- limit ytwo sub scaleby mul xfour scaleby mul
- limit yone sub scaleby mul xthree scaleby mul
- limit scaleby mul 0 curveto
- limit yone sub scaleby mul xthree scaleby mul neg
- limit ytwo sub scaleby mul xfour scaleby mul neg
- 0 xfive scaleby mul neg curveto
- limit ytwo sub scaleby mul neg xfour scaleby mul neg
- limit yone sub scaleby mul neg xthree scaleby mul neg
- limit scaleby mul neg 0 curveto
- ocolorfill
- limit neg 0 translate
- /scaleby scaleby .1 sub def
- wild 1 eq {/ohue ohue wildmig add dup 1 gt {1 sub} if def}
- {/obright obright .1 add def /ohue ohue mig add dup 1 gt {1 sub} if def}
- ifelse
- } repeat
- /scaleby 1 def /obright 0 def
- wild .5 eq {/hue ohue .15 add dup 1 gt {1 sub} if def} if
- /scaleby 1 def
- 10 {
- wild 1 eq {/bright 1 def /hue ohue def} if
- scaleby scaleby scale
-
- 0 anyone moveto
- xone limit lineto
- xtwo xtwo lineto
- limit xone lineto
- anyone 0 lineto
- limit xone neg lineto
- xtwo xtwo neg lineto
- xone limit neg lineto
- 0 anyone neg lineto
- xone neg limit neg lineto
- xtwo neg xtwo neg lineto
- limit neg xone neg lineto
- anyone neg 0 lineto
- limit neg xone lineto
- xtwo neg xtwo lineto
- xone neg limit lineto
- 0 anyone lineto
-
- 0 0 moveto
- yone xthree ytwo xfour limit xfive curveto
- ythree xsix yfour xseven xeight xeight curveto
- xseven yfour xsix ythree xfive limit curveto
- xfour ytwo xthree yone 0 0 curveto
-
- xthree yone neg xfour ytwo neg xfive limit neg curveto
- xsix ythree neg xseven yfour neg xeight xeight neg curveto
- yfour xseven neg ythree xsix neg limit xfive neg curveto
- ytwo xfour neg yone xthree neg 0 0 curveto
-
- yone neg xthree neg ytwo neg xfour neg limit neg xfive neg curveto
- ythree neg xsix neg yfour neg xseven neg xeight neg xeight neg curveto
- xseven neg yfour neg xsix neg ythree neg xfive neg limit neg curveto
- xfour neg ytwo neg xthree neg yone neg 0 0 curveto
-
- xthree neg yone xfour neg ytwo xfive neg limit curveto
- xsix neg ythree xseven neg yfour xeight neg xeight curveto
- yfour neg xseven ythree neg xsix limit neg xfive curveto
- ytwo neg xfour yone neg xthree 0 0 curveto
-
- % This is what things with normal limits use
- colorfill
- 0 0 moveto
- 1 scaleby div dup scale
-
- /scaleby scaleby .1 sub def
- wild 1 eq
- {/ohue ohue wildmig add dup 1 gt {1 sub } if def}
- {/bright bright .1 sub def /ohue ohue mig add dup 1 gt {1 sub} if def}
- ifelse
-
- } repeat
- 0 0 moveto
- 0 boxsize translate
- } repeat
- boxsize boxsize ytimes mul neg translate
- } repeat
- } def
- endps
-